<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-for,v-if</title>
    <style>

    </style>
</head>
<body>
    <div id="app1">	
        <p>{{msg}}</p>
        <input type="button" value="修改msg" @click="changeMsg">
        <p>{{reverseMsg}}</p>
        <p>{{reverseMsg}}</p>
        <p>{{reverseMsg}}</p>
        <p>{{reverseMsgFn()}}</p>
        <p>{{reverseMsgFn()}}</p>
        <p>{{reverseMsgFn()}}</p>
    </div>
</body>
</html>
<script src="js/vue.js"></script>
<script>

let vm = new Vue({
    el:"#app1",
    data:{       
        msg:"how old are you "
    },
    computed:{
        reverseMsg:function(){
            console.log("computed");
            return this.msg.split("").reverse().join("");
        }
    },
    methods:{
        reverseMsgFn:function(){
            console.log("methods");
            return this.msg.split("").reverse().join("");
        },
        changeMsg(){
            this.msg = "what are you 弄啥嘞"
        }
    }
});


</script>